/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.contract.mongo.entity;


import com.pig4cloud.pigx.common.customize.contants.MongoTableNameConstants;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 成交记录表mongodb实体类
 *
 * @date 2022-08-18 09:40:29
 */
@Data
@Document(MongoTableNameConstants.CONTRACT_TRADE_NEW)
public class ContractTradeMongo implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	@Id
	private Long id;

	/**
	 * 用户id
	 */
	private Long userId;

	/**
	 * 币对id
	 */
	private Long symbolId;

	/**
	 * 币对名称
	 */
	private String symbolName;

	/**
	 * 订单id
	 */
	private Long orderId;

	/**
	 * 订单类型（0市价单、1限价单、2强平单）
	 */
	private String orderType;

	/**
	 * 对手盘用户id
	 */
	private Long makerUserId;

	/**
	 * 对手盘订单id
	 */
	private Long makerOrderId;

	/**
	 * 对手盘成交记录id
	 */
	private Long makerTradeId;

	/**
	 * 仓位id
	 */
	private Long positionId;

	/**
	 * 是否是买单（0否，是卖单、1是买单）
	 */
	private String isBuy;

	/**
	 * 是否机器人（0否、1是）
	 */
	private String isRobot;

	/**
	 * 订单方向（0做多、1做空）
	 */
	private String side;

	/**
	 * 操作类型（0开仓、1平仓）
	 */
	private String operationType;

	/**
	 * 成交价格
	 */
	private BigDecimal price;

	/**
	 * 成交数量
	 */
	private BigDecimal num;

	/**
	 * 交易面值
	 */
	private BigDecimal tradeValue;

	/**
	 * 倍数
	 */
	private Integer multiple;

	/**
	 * 手续费
	 */
	private BigDecimal handlingFee;

	/**
	 * 手续费率
	 */
	private BigDecimal handlingFeeRate;

	/**
	 * 保证金
	 */
	private BigDecimal margin;

	/**
	 * 收益，平仓时有值
	 */
	private BigDecimal profit;

	/**
	 * 强平清算费
	 */
	private BigDecimal liquidateFee;

	/**
	 * 强平清算费率
	 */
	private BigDecimal liquidateFeeRate;

	/**
	 * 创建时间
	 */
	private LocalDateTime createTime;

	/**
	 * 创建人
	 */
	private Long createBy;

	/**
	 * 修改时间
	 */
	private LocalDateTime updateTime;

	/**
	 * 修改人
	 */
	private Long updateBy;

	/**
	 * 状态（暂无作用）
	 */
	private String status;

	/**
	 * 是否删除（null是、0否）
	 */
	private String isDeleted;

	/**
	 * 仓位模式（0逐仓、1全仓），辅助在后续业务中定位仓位
	 */
	private String positionMode;

	/**
	 * 是否是条件挂单，辅助后续业务
	 */
	private Boolean isConditionPending = false;

	/**
	 * 订单的数量，辅助后续业务
	 */
	private BigDecimal orderNum;

	/**
	 * 订单的保证金，辅助后续业务
	 */
	private BigDecimal orderMargin;
}
